
// Detect if the browser is IE or not.
// If it is not IE, we assume that the browser is FF/NS.
var IE = document.all?true:false

// If NS -- that is, !IE -- then set up for mouse capture
if (!IE)
{
	document.captureEvents(Event.MOUSEMOVE)
}

// Set-up to use getMouseXY function onMouseMove
document.onmousemove = getMouseXY;

// Temporary variables to hold mouse x-y positions
var currentMouseX = 0;
var currentMouseY = 0;

// Main function to retrieve mouse x-y positions
function getMouseXY(e)
{
	if (IE)
	{
		// grab the x-y pos.s if browser is IE
		currentMouseX = event.clientX + document.body.scrollLeft;
		currentMouseY = event.clientY + document.body.scrollTop;
	}
	else
	{
		// grab the x-y pos.s if browser is NS
		currentMouseX = e.pageX
		currentMouseY = e.pageY
	}
	// catch possible negative values in NS4
	if (currentMouseX < 0)
	{
		currentMouseX = 0;
	}
	if (currentMouseY < 0)
	{
		currentMouseY = 0;
	}
	return true;
}

var currentCoverISBN = 0;

function showCover(isbn)
{
    var isbnonly = isbn.match(/[0-9a-zA-Z]{1,13}/);
    isbn = isbnonly;
    var coverDiv = document.getElementById("bookCover");
    // set the position
    coverDiv.style.top  = currentMouseY - 10;
    coverDiv.style.left = currentMouseX + 20;
    // make the div visible
    coverDiv.style.display="";
    // format the html
    coverDiv.innerHTML = '<img border="0" src="http://lib.syndetics.com/index.aspx?isbn=' +isbn + '/SC.GIF&client=eangliau&type=xw12" />';
    // record which cover is being displayed
    currentCoverISBN = isbn;
    // hide the cover again in a second
    setTimeout("hideCover('"+isbn+"')",1500);
}

function hideCover(isbn)
{
	if( currentCoverISBN == isbn )
	{
		var coverDiv = document.getElementById("bookCover");
		coverDiv.style.display="none";
		currentCoverISBN = 0;
	}
}
